/* entity */
import Field from '@model/entity/Field'
/* enum */
import Column from '@model/types/Column'
import { FieldTypeMappingEnum, LogisticsFieldNameMappingEnum, TaskFieldNameMappingEnum } from '@model/enum/FieldMappingEnum'
import { FieldIsNullTypeEnum, ProductFieldNameMappingEnum, ProductTypeFieldNameMappingEnum } from '@model/enum/FieldMappingEnum'
/* utils */
import { isArray, isEmpty, isFunction, isNumber, isObject, isUndefined } from '@src/util/type'
import { fieldArrayToObject, stringArrayToObject, stringArrayToObject2 } from '@src/util/array'
import { _isHiddenField, initialize } from '@src/component/form/util';
import Log from '@src/util/log.ts'
import _ from 'lodash'

type DependenciesFieldNameMap = Record<string, string[]>

// 过滤导出字段的字段类型列表
const FilterExportFieldFormTypes: FieldTypeMappingEnum[] = [
  FieldTypeMappingEnum.Attachment,
  FieldTypeMappingEnum.Autograph,
  FieldTypeMappingEnum.Separator,
  FieldTypeMappingEnum.Connector,
  FieldTypeMappingEnum.JsCodeBlock
]


const FilterTaskExportFieldFormTypes: FieldTypeMappingEnum[] = [
  FieldTypeMappingEnum.Attachment,
  FieldTypeMappingEnum.Autograph,
  FieldTypeMappingEnum.Separator,
  FieldTypeMappingEnum.JsCodeBlock
]



/**
 * @description 过滤导出字段的字段类型
 */
export function filterExportFieldWithFormType(field: Field, exceptType?: Array<any> | any): boolean {
  try {
    // 针对部分特殊场景不需要过滤一些类型
    if(exceptType && exceptType.length && exceptType.includes(field.formType)){
      return true
    }
    return !FilterExportFieldFormTypes.includes(field.formType as FieldTypeMappingEnum)
  } catch (error) {
    Log.error(error, filterExportFieldWithFormType.name)
    return true
  }
}

/**
 * @description: 获取字段名称
 * @param {Field} field 字段
 */
export function getFieldName(field: Field | Column | undefined): string {
  // @ts-ignore
  return field?.field || field?.fieldName || field?.name || ''
}
// 工单不过滤连接器
export function filterTaskExportFieldWithFormType(field: Field, exceptType?: Array<any> | any): boolean {
  try {
    // 针对部分特殊场景不需要过滤一些类型
    if(exceptType && exceptType.length && exceptType.includes(field.formType)){
      return true
    }
    return !FilterTaskExportFieldFormTypes.includes(field.formType as FieldTypeMappingEnum)
  } catch (error) {
    Log.error(error, filterTaskExportFieldWithFormType.name)
    return true
  }
}

/**
 * @description: 获取字段类型
 * @param {Field} field 字段
 */
export function getFieldFormType(field: Field | Column | Record<string, any>): string {
  return field?.formType || ''
}

/**
 * @description: 获取字段显示名称
 * @param {Field} field 字段
 */
export function getFieldDisplayName(field: Field | undefined): string {
  return field?.displayName || ''
}
/**
 * 获取设置
 */
export function getFieldSetting(field: Field | undefined): object {
  return field?.setting || {}
}

// 质保规则 dataType  1 关联型 0 自定义
export function getFieldSettingDataType(field: Field | undefined): number {
  const findQualityRuleField = (field || []).find(item => item?.formType === FieldTypeMappingEnum.QualityRule) || {}
  return findQualityRuleField.setting?.dataType
}
/**
 * @description: 获取字段选择数据资源
 * @param {Field} field 字段
 */
export function getFieldDataSource(field: Field | undefined): (string | Record<string, any>)[] {
  return field?.setting?.dataSource || []
}

/**
 * @description: 获取字段是否为空属性
 * @param {Field} field 字段
 */
export function getFieldIsNull(field: Field | Record<string, any> | undefined): number {
  return isNumber(field?.isNull) ? field?.isNull : 1
}

/**
 * @description: 设置字段类型
 * @param {Field} field 字段
 */
export function setFieldFormType(field: Field, formType: string): void {
  try {
    field.formType = formType
  } catch (error) {
    Log.error(error, setFieldFormType.name)
  }
}

/**
 * @description: 设置字段类型是否为空
 * @param {Field} field 字段
 * @param {boolean} isNull 是否为空
 */
export function setFieldIsNull(field: Field | Record<string, any>, isNull: boolean): void {
  try {
    field.isNull = Number(isNull)
  } catch (error) {
    Log.error(error, setFieldIsNull.name)
  }
}

/**
 * @description: 是否是相同的字段
 * @param {Field} field1 字段1
 * @param {Field} field2 字段2
 * @return {Boolean} 是否相等
*/
export function isSameField(field1: Field, field2: Field): boolean {
	return (
    field1.field === field2.field
    || field1.fieldName === field2.fieldName
    || field1.field === field2.fieldName
    || field1.fieldName === field2.field
  )
}

/**
 * @description: 当前字段是否支持搜索
 * @param {Field} field 字段
*/
export function isSearchField(field: Field): boolean {
	return Boolean(field?.isSearch && field.isSearch === 1)
}

/**
 * @description: 当前字段是为系统字段
*/
export function isSystemFiled(field: Field | Column): boolean {
	return Boolean(field?.isSystem && (field.isSystem === 1 || field.isSystem === true))
}

/**
 * @description: 当前字段是为附件字段
*/
export function isAttachmentFiled(field: Field | Column): boolean {
	return Boolean(field?.formType === FieldTypeMappingEnum.Attachment)
}

/**
 * @description: 是否为工单编号字段
 * @param {Field} field 字段
*/
export function isTaskNoField(field: Field): boolean {
	return getFieldName(field) === TaskFieldNameMappingEnum.TaskNo
}

/**
 * @description: 当前字段是为备注字段
*/
export function isRemarkFiled(field: Field | Column): boolean {
	return Boolean(getFieldName(field) === TaskFieldNameMappingEnum.Remark)
}

/**
 * @description: 是否为计划时间字段
 * @param {Field} field 字段
*/
export function isPlanTimeField(field: Field): boolean {
	return getFieldName(field) === TaskFieldNameMappingEnum.PlanTime
}

/**
 * @description: 是否为计划开始时间字段
 * @param {Field} field 字段
*/
export function isPlanStartTimeField(field: Field): boolean {
	return getFieldName(field) === TaskFieldNameMappingEnum.PlanStartTime
}

/**
 * @description: 是否为计划完成时间字段
 * @param {Field} field 字段
*/
export function isPlanEndTimeField(field: Field): boolean {
	return getFieldName(field) === TaskFieldNameMappingEnum.PlanEndTime
}

/**
 * @description: 是否为工单描述字段
 * @param {Field} field 字段
*/
export function isDescriptionField(field: Field): boolean {
	return getFieldName(field) === TaskFieldNameMappingEnum.Description
}

/**
 * @description: 是否为用户字段
 * @param {Field} field 字段
*/
export function isUserField(field: Field): boolean {
	return Boolean(field?.formType === FieldTypeMappingEnum.User)
}

/**
 * @description: 是否为分组字段
 * @param {Field} field 字段
*/
export function isGroupField(field: Field): boolean {
	return Boolean(field?.formType === FieldTypeMappingEnum.Group)
}

/**
 * @description: 是否为质保规则时长字段
 * @param {Field} field 字段
*/
export function isQualityTimeField(field: Field): boolean {
	return getFieldName(field) === ProductTypeFieldNameMappingEnum.QualityTime
}

/**
 * @description: 是否为质保规则 质保起算时间字段
 * @param {Field} field 字段
*/
export function isQualityRuleStartTimeField(field: Field): boolean {
	return getFieldName(field) === ProductTypeFieldNameMappingEnum.QualityStartTime
}

/**
 * @description: 是否为质保规则字段
 * @param {Field} field 字段
*/
export function isQualityRuleField(field: Field): boolean {
	return Boolean(field?.formType === FieldTypeMappingEnum.QualityRule)
}

/**
 * @description: 是否为质保信息字段
 * @param {Field} field 字段
*/
export function isQualityInfoField(field: Field): boolean {
	return getFieldFormType(field) === FieldTypeMappingEnum.QualityInfo || getFieldName(field) === ProductFieldNameMappingEnum.QualityInfo || getFieldName(field) === 'quality'
}

/**
 * @description: 是否为质保信息质保开始时间字段
 * @param {Field} field 字段
*/
export function isQualityInfoStartTimeField(field: Field): boolean {
	return getFieldName(field) === ProductFieldNameMappingEnum.QualityInfoStartTime
}

/**
 * @description: 是否为质保信息质保结束时间字段
 * @param {Field} field 字段
*/
export function isQualityInfoEndTimeField(field: Field): boolean {
	return getFieldName(field) === ProductFieldNameMappingEnum.QualityInfoEndTime
}

/**
 * @description: 是否为质保信息质保状态字段
 * @param {Field} field 字段
*/
export function isQualityInfoStatusField(field: Field): boolean {
	return getFieldName(field) === ProductFieldNameMappingEnum.QualityInfoStatus
}

/**
 * @description: 是否为货币金额字段
 * @param {Field} field 字段
*/
export function isCurrencyField(field: Field): boolean {
	return Boolean(field?.formType === FieldTypeMappingEnum.Currency)
}

/**
 * @description: 是否为说明信息字段
 * @param {Field} field 字段
*/
export function isInfoField<T>(field: Field | T): boolean {
	return getFieldFormType(field) === FieldTypeMappingEnum.Info
}

/**
 * @description: 是否为分割线字段
 * @param {Field} field 字段
*/
export function isSeparatorField<T>(field: Field | T): boolean {
	return getFieldFormType(field) === FieldTypeMappingEnum.Separator
}

/**
 * @description: 是否为关联产品字段
 * @param {Field} field 字段
*/
export function isRelatedProductField<T>(field: Field | T): boolean {
	return getFieldFormType(field) === FieldTypeMappingEnum.RelatedProduct
}

/**
 * @description: 是否为邮箱字段
 * @param {Field} field 字段
*/
export function isEmailField<T>(field: Field | T): boolean {
	return getFieldFormType(field) === FieldTypeMappingEnum.Email
}

/**
 * @description: 是否为连接器字段
 * @param {Field} field 字段
*/
export function isConnectorField<T>(field: Field | T): boolean {
	return getFieldFormType(field) === FieldTypeMappingEnum.Connector
}

/**
 * @description: 是否为 关联工单 字段
 * @param {Field} field 字段
*/
export function isRelatedTaskField<T>(field: Field | T): boolean {
	return getFieldFormType(field) === FieldTypeMappingEnum.RelatedTask
}

/**
 * @description: 是否为 关联表单 字段
 * @param {Field} field 字段
*/
export function isRelatedFormField<T>(field: Field | T): boolean {
	return getFieldFormType(field) === FieldTypeMappingEnum.RelatedForm
}

/**
 * @description: 是否为 备件 字段
 * @param {Field} field 字段
*/
export function isSparepartField<T>(field: Field | T): boolean {
	return getFieldFormType(field) === FieldTypeMappingEnum.Sparepart
}

/**
 * @description: 是否为 服务项目 字段
 * @param {Field} field 字段
*/
export function isServiceItermField<T>(field: Field | T): boolean {
	return getFieldFormType(field) === FieldTypeMappingEnum.ServiceIterm
}

/**
 * @description: 是否为 服务商 字段
 * @param {Field} field 字段
*/
export function isServiceProvidersField<T>(field: Field | T): boolean {
	return getFieldFormType(field) === FieldTypeMappingEnum.ServiceProviders
}

/**
 * @description: 是否为 故障库 字段
 * @param {Field} field 字段
*/
export function isFaultLibraryField<T>(field: Field | T): boolean {
	return getFieldFormType(field) === FieldTypeMappingEnum.FaultLibrary
}

/**
 * @description: 是否为 物料返还 字段
 * @param {Field} field 字段
*/
export function isMaterialReturnField<T>(field: Field | T): boolean {
	return getFieldFormType(field) === FieldTypeMappingEnum.MaterialReturn
}

/**
 * @description: 是否为 物料核销 字段
 * @param {Field} field 字段
*/
export function isMaterialVerifyEliminateField<T>(field: Field | T): boolean {
	return getFieldFormType(field) === FieldTypeMappingEnum.MaterialVerifyEliminate
}

/**
 * @description: 是否为 服务商资质 字段
 * @param {Field} field 字段
*/
export function isServiceProviderQualificationField<T>(field: Field | T): boolean {
	return getFieldFormType(field) === FieldTypeMappingEnum.ServiceProviderQualification
}

/**
 * @description: 是否为 工程师资质 字段
 * @param {Field} field 字段
*/
export function isEngineerQualificationField<T>(field: Field | T): boolean {
	return getFieldFormType(field) === FieldTypeMappingEnum.EngineerQualification
}

/**
 * @description: 是否为 产品质保 字段
 * @param {Field} field 字段
*/
export function isProductWarrantyServiceField<T>(field: Field | T): boolean {
	return getFieldFormType(field) === FieldTypeMappingEnum.ProductWarrantyService
}

/**
 * @description: 是否为 备件返还 字段
 * @param {Field} field 字段
*/
export function isSparePartsReturnExpenseField<T>(field: Field | T): boolean {
	return getFieldFormType(field) === FieldTypeMappingEnum.SparePartsReturnExpense
}

/**
 * @description: 不支持显示的字段
 * @param {Field | Column} field 字段
 * @return {Boolean} 是否支持显示
 */
export function isNotSupportedDisplayField(field: Field | Column): boolean {
  /**
   * 不支持显示的字段类型列表
   * 附件，分割线，说明信息，签名
  */
  const notSupportedDisplayFieldsFormType: FieldTypeMappingEnum[] = [
    FieldTypeMappingEnum.Attachment,
    FieldTypeMappingEnum.Separator,
    FieldTypeMappingEnum.Info,
    FieldTypeMappingEnum.Autograph
  ]

  return notSupportedDisplayFieldsFormType.includes(field.formType as FieldTypeMappingEnum)
}

/**
 * @description: 字段排序
 * @param {Field[] | Column[]} fields 字段
*/
export function sortFields(fields: Field[], sortFieldNames: string[]): Field[] {
  // 没排序字段数组参数，则按照 orderId默认规则排序
	if (isEmpty(sortFieldNames)) return sortFieldsWithOrderId(fields)

  // 排序字段对象
  const FiledSortMap: Record<string, string> = stringArrayToObject2(sortFieldNames)
  // 排序的字段列表
  const SortedFields: Field[] = []
  // 未排序的字段列表
  const UnSortedFields: Field[] = []

  // 字段名称
  let fieldName: string = ''
  // 字段索引
  let fieldIndex: string = ''

  fields.forEach((field: Field) => {
    // 字段名称
    fieldName = getFieldName(field)
    fieldIndex = FiledSortMap[fieldName]

    // 排序字段对象存在此字段名称则取其索引
    if (!isUndefined(fieldIndex)) {
      SortedFields[Number(fieldIndex)] = field
    } else {
      UnSortedFields.push(field)
    }

  })

  const ResultFields: Field[] = [
    ...SortedFields,
    ...UnSortedFields
  ]

  return ResultFields.filter((field: Field) => Boolean(field))

}

/**
 * @description: 字段排序按照
 * @param {Field[]} fields 字段
*/
function sortFieldsWithOrderId(fields: Field[]): Field[] {
  return (
    fields.sort((field1: Field, field2: Field) => {
      // @ts-ignore
      return field1?.orderId - field2?.orderId
    })
  )
}

/**
 * @description: 合并字段列表
 * @param {Field[]} fieldsLeft 左侧字段列表
 * @param {Field[]} fieldsRight 右侧字段列表
 * @param {string} mergeFieldNames 需要合并字段的字段名数组
 * @param {boolean} isLeftJoin
 * @return {Field[]} 合并完的字段列表
 */
export function mergeFields(fieldsLeft: Field[], fieldsRight: Field[], mergeFieldNames: string[], isLeftJoin: boolean = false): Field[] {
  // 需要合并字段的字段名称对象
  const MergeFieldNameMap: Record<string, string> = stringArrayToObject(mergeFieldNames)
  // 左侧字段列表
  const FieldsLeftMap: Record<string, Field> = fieldArrayToObject(isLeftJoin ? fieldsRight : fieldsLeft)
  // 右侧字段列表
  const FieldsRightMap: Record<string, Field> = fieldArrayToObject(isLeftJoin ? fieldsLeft : fieldsRight)

  const MergedFieldsMap = isLeftJoin ? { ...FieldsRightMap, ...FieldsLeftMap } :  { ...FieldsLeftMap, ...FieldsRightMap }
  // 合并后的结果字段列表
  let mergedResultFields: Field[] = []

  // 遍历左侧字段列表
  for (let fieldName in MergedFieldsMap) {
    /**
     * 如果需要合并字段的字段名称对象里面 不存在此字段名
     * 或者 右侧字段名称对象里面 不存在此字段名
    */
    if (
      !MergeFieldNameMap[fieldName]
      || !FieldsRightMap[fieldName]
    ) {
      mergedResultFields.push(MergedFieldsMap[fieldName])
      continue
    }

    mergedResultFields.push({
      ...MergedFieldsMap[fieldName],
      ...FieldsRightMap[fieldName]
    })

  }

  return mergedResultFields
}

/**
 * @description:
 * -- 默认使用fieldName为键名
 * ! Note: 注意此方法会改变原对象
 * @param {Field} fieldsLeft
 * @param {Field} fieldsRight
 * @param {Function} customizer
 * @return {void}
 */
export function mergeFieldsWithProperty<Left, Right, Result>(
  fieldsLeft: Left[],
  fieldsRight: Right[],
  customizer: (leftFieldItem: Left, rightFieldItem: Right) => Result
): Result[] {

  // 效验自定义合并函数类型
  if (!isFunction(customizer)) {
    Log.error('Caused: customizer must be a function', mergeFieldsWithProperty.name)
    return []
  }
    // FieldsLeftMap是查询的所有的表单字段，FieldsRightMap只是存放了缓存中的字段，如果表单设计器那边新增字段可能漏掉FieldsLeftMap的，需要加上去
    let FieldsAll = _.cloneDeep(fieldsRight);
    fieldsLeft.forEach(item => {
        if(FieldsAll?.every(zitem => getFieldName(item) !== getFieldName(zitem))) {
            FieldsAll.push({fieldName: getFieldName(item), show: item?.show ?? false})
        }
    })

  // 左侧字段列表
  const FieldsLeftMap: Record<string, Left> = fieldArrayToObject<Left>(fieldsLeft)
  // 右侧字段列表
  const FieldsRightMap: Record<string, Right> = fieldArrayToObject<Right>(FieldsAll)

  let leftFieldItem: Left
  let rightFieldItem: Right
  let result: Result[] = []
  for (let fieldName of Object.keys(FieldsRightMap)) {
    leftFieldItem = FieldsLeftMap[fieldName]
    rightFieldItem = FieldsRightMap[fieldName]

    result.push(customizer(leftFieldItem, rightFieldItem))
  }

  return result
}

export function getFieldWithFieldName(fields: Field[], fieldName: string): Field | null {
  try {
    return fields.filter((field: Field) => getFieldName(field) === fieldName)[0] || null
  } catch (error) {
    Log.error(error, getFieldWithFieldName.name)
    return null
  }
}

/**
 * @description 是否存在某个字段
 */
export function existsField(fieldName: TaskFieldNameMappingEnum | string, fields?: Field[], fieldsMap?: Record<string, Field>): Field | null {
  if (!isUndefined(fields) && isArray(fields)) return existsFieldWithFields(fieldName, fields as Field[])
  if (!isUndefined(fieldsMap) && isObject(fieldsMap)) return existsFieldWithFieldsMap(fieldName, fieldsMap as Record<string, Field>)

  return null
}

/**
 * @description: 字段列表中是否存在某个字段
 * @param {TaskFieldNameMappingEnum} fieldName 字段名称
 * @param {Field} fields 字段列表
 * @return {Field | null}
 */
function existsFieldWithFields(fieldName: TaskFieldNameMappingEnum | string, fields: Field[]): Field | null {
  let field: Field | null = null

  try {
    for (let fieldValue of fields) {
      if (getFieldName(fieldValue) === fieldName) {
        field = fieldValue
        break
      }
    }
  } catch (error) {
    field = null
    Log.error(error, existsFieldWithFields.name)
  }

  return field
}

/**
 * @description: 字段列表对象中是否存在某个字段
 * @param {TaskFieldNameMappingEnum} fieldName 字段名称
 * @param {Record} fieldsMap 字段列表对象
 * @return {Field | null}
 */
function existsFieldWithFieldsMap(fieldName: TaskFieldNameMappingEnum | string, fieldsMap: Record<string, Field>): Field | null {
  return fieldsMap[fieldName] ?? null
}

export function isEnabled(fields: Field): boolean {
  return fields?.enabled === 1
}

/**
 * @description 获取分组子字段列表
 * @param {Field} field 分组字段
 * @return {Field[]} 分组子字段列表
 */
export function getFormGroupFields(field: Field): Field[] {
  return field?.groupFields || []
}

/**
 * @description 抹平字段列表
 * -- 目前仅针对分组字段
 * @param {Field[]} fields 原字段列表
 * @return {Field[]} 抹平后的字段列表
 */
export function smoothFields(fields: Field[]): Field[] {
  let smoothedFields: Field[] = []

  fields.forEach((field: Field) => {

    if (isGroupField(field)) {
      smoothedFields = smoothedFields.concat(getFormGroupFields(field))
      return
    }

    smoothedFields.push(field)
  })

  return smoothedFields
}

/**
 * @description: 是否字段不为空(必填)
 * @param {Field} field 字段
*/
export function isFieldNotNull(field: Field): boolean {
	return field?.isNull == FieldIsNullTypeEnum.NotNull
}

/**
 * @description 获取某个字段
 */
export function getField(fieldName: TaskFieldNameMappingEnum, fields?: Field[], fieldsMap?: Record<string, Field>): Field | null {
  if (!isUndefined(fields) && isArray(fields)) return existsFieldWithFields(fieldName, fields as Field[])
  if (!isUndefined(fieldsMap) && isObject(fieldsMap)) return existsFieldWithFieldsMap(fieldName, fieldsMap as Record<string, Field>)

  return null
}

export function getDependenciesFieldNameMap(fields: Field[]): Record<string, DependenciesFieldNameMap> {

  if (!isArray(fields) || isEmpty(fields)) return {}

  let dependenciesFieldNameMap: Record<string, DependenciesFieldNameMap> = {}
  let isNotHaveDependencies: boolean
  let dependencies: Record<string, string[]>

  fields.forEach((field: Field) => {

    dependencies = field?.setting?.dependencies as Record<string, string[]>
    isNotHaveDependencies = isEmpty(dependencies) && !isObject(dependencies)

    if (isNotHaveDependencies) return

    Object.keys(dependencies).forEach((dependencyFieldName: string) => {

      if (!dependenciesFieldNameMap[dependencyFieldName]) {
        dependenciesFieldNameMap[dependencyFieldName] = {}
      }

      dependenciesFieldNameMap[dependencyFieldName][field.fieldName] = dependencies[dependencyFieldName]

    })

  })

  return dependenciesFieldNameMap

}

/**
 * @description: 过滤隐藏字段对应的值
 * @param {Field[]} fields 字段列表
 * @param {Record<string, any>} formData 表单数据
 * @param {Boolean} isAttribute 是否有自定义属性
 * @return {Record<string, any>} 过滤后的表单数据
 */
export function hiddenFieldValueFilterHandler<T extends Record<string, any>>(
  fields: Field[],
  formData: T,
  isAttribute: boolean = false
): T {

  const hiddenFields: Field[] = []
  const fieldMap: Record<string, Field> = fieldArrayToObject(fields)
  const isSmooth: boolean = !isAttribute

  fields.forEach((field: Field) => {

    if (_isHiddenField(field, formData, fieldMap, isSmooth)) {
      hiddenFields.push(field)
      return
    }

  })

  const emptyHiddenFieldValue: Record<string, any> = initialize(
    hiddenFields,
    {},
    undefined,
    {
      isUseFieldDefaultValue: false,
    }
  )

  let result = {} as T

  if (isAttribute) {
    result = {
      ...formData,
      attribute: Object.assign({}, formData.attribute, emptyHiddenFieldValue)
    }
  } else {
    result = {
      ...formData,
      ...emptyHiddenFieldValue
    }
  }

  return result;
}

/**
 * @description: 是否为物流字段
 * @param {Field} field 字段
 */
export function isLogisticsField(field: Field): boolean {
  return getFieldFormType(field) === FieldTypeMappingEnum.Logistics;
}

/**
 * @description: 是否为物流单号字段
 * @param {Field} field 字段
 */
export function isLogisticsNoField(field: Field): boolean {
  return isLogisticsField(field) && getFieldName(field).indexOf(LogisticsFieldNameMappingEnum.LogisticsNo) > -1;
}

export function isJsCodeBlockField(field: Field): boolean {
  return field.formType === FieldTypeMappingEnum.JsCodeBlock
}

export default {
  isSameField,
  isSearchField,
  isSystemFiled,
  isNotSupportedDisplayField,
  getFieldName,
  getFieldWithFieldName,
  existsField,
  isFieldNotNull,
  isQualityInfoStartTimeField,
  isQualityInfoEndTimeField,
  isQualityInfoStatusField,
  isCurrencyField,
  getField,
  getDependenciesFieldNameMap,
  hiddenFieldValueFilterHandler,
  isLogisticsField,
  isJsCodeBlockField
}
